<?php

	if(! isset($_SESSION['etape']) && $page != "index"){
		header("Location: index.php");
		exit;
	}

	if(isset($page) && isset($_SESSION['etape']))
	
		switch($page)
		{
			case 'index': 
				if($_SESSION['etape'] == 2) { header("Location: verifications.php"); exit; } 
				else if($_SESSION['etape'] > 1 && $_SESSION['etape'] < 4) { header("Location: bdd.php"); exit;}
				else if($_SESSION['etape'] >= 4) { header("Location: fin.php"); exit;}	
			break;
			case 'verifications': 
				if($_SESSION['etape'] > 1 && $_SESSION['etape'] < 4) { header("Location: bdd.php"); exit; } 
				else if($_SESSION['etape'] >= 4) { header("Location: fin.php"); exit;}	
			break;
			case 'bdd':
				if($_SESSION['etape'] == 1) { header("Location: index.php"); exit; } 
				if($_SESSION['etape'] < 2) { header("Location: verifications.php"); exit; } 
				else if($_SESSION['etape'] > 4) { header("Location: fin.php"); exit;}	
			break;
			case 'choixbase': 
				if($_SESSION['etape'] == 1) { header("Location: index.php"); exit; } 
				if($_SESSION['etape'] < 2) { header("Location: verifications.php"); exit; } 
				else if($_SESSION['etape'] < 4) { header("Location: bdd.php"); exit;}
				else if($_SESSION['etape'] >= 4) { header("Location: fin.php"); exit;}	
			break;			
			case 'configuration': 
				if($_SESSION['etape'] == 1) { header("Location: index.php"); exit; } 
				if($_SESSION['etape'] == 2) { header("Location: verifications.php"); exit; } 
				else if($_SESSION['etape'] >= 4) { header("Location: fin.php"); exit;}	
			break;			

		}	

?>